<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
		<meta charset="utf-8" />
		<meta name="keywords" content="pinpin社保" />
		<meta name="description" content="pinpin社保" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="renderer" content="webkit" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
		<title>社保运营后台-绑定现金券管理</title>
	<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
<script language="javascript">
function selectAll(btn,items){
  var selectAll=btn;
  var nid_var=document.getElementsByName(items);
  for(var i = 0; i < nid_var.length; i ++ ) {
	nid_var[i].checked = selectAll.checked;
	}
}
 </script>
</head>
<body>
	<div id="wrapper">
		<%@ include file="/WEB-INF/jsp/common/menu.jsp" %>
        <div id="page-wrapper">
        	<div class="row">
                <div class="col-lg-12">
                    <!-- 路径导航 -->
                    <ol class="breadcrumb">
				      <li>社保后台</li>
				      <li class="active">现金券管理</li>
				    </ol>
                </div>
            </div>
            <div class="row">
            	<div class="col-lg-12">
            		<div class="panel panel-default">
            			<div class="panel-body">
        			    	<div class="form-inline dt-bootstrap no-footer">
        			    		<!-- 表单查询 -->
        			    		<!-- 表单查询 -->
        			    		<div class="row">
        			    			<div class="col-lg-12">
        			    			<form action="" method="get">
                                        <input type="text" class="form-control" name="name" placeholder="请输入现金券名称" value="${couponQueryForm.name }">
        			    			    <input type="hidden" name="pageNo" value="${pageNo }">
        			    			    <input type="hidden" name="user_id" value="${couponQueryForm.user_id }">
        			    			    <input type="submit" class="btn btn-primary" value="查 询">
        			    			    </form>
        			    			</div>
        			    		</div>
        			    		<hr />
        			    		<!-- 分页 -->
        			    		<c:set var="page_link" value="?user_id=${couponQueryForm.user_id }&"></c:set>
                            <c:set var="pre_disabled" value=""></c:set>
		    				<c:if test="${pageModel.pageNo le 1}">
		    					<c:set var="pre_disabled" value="disabled"></c:set>
		    				</c:if>
		    				<c:set var="next_disabled" value=""></c:set>
		    				<c:if test="${pageModel.pageNo ge pageModel.pageTotal}">
		    					<c:set var="next_disabled" value="disabled"></c:set>
		    				</c:if>
                                <br/>
        			    		<div class="row">
        			    			<div class="col-lg-10">
        			    			<form action="" method="get">
        			    				<div class="ss-pagination">
                                            <span class="ui-text-box">共${pageModel.totalRecord }条 ${pageModel.pageTotal }页</span>
                                            <span class="ui-text-box">每页${pageModel.pageSize }条</span>
                                            <span class="ui-text-box">当前第${pageModel.pageNo }页</span>
        			    					<ul class="pagination">
        			    						<li class="previous ${pre_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.previousPageNo }">上一页</a></li>
        			    						<%@ include file="page_queue.jsp" %>
        			    						<li class="next ${next_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.nextPageNo }">下一页</a></li>
        			    					</ul>
                                            <span>向第</span>
                                            <input type="text" class="form-control" name="pageNo" size="3">
                                            <input type="hidden" class="form-control" name="user_id" value="${couponQueryForm.user_id }">
                                            <span>页</span>
                                            <button type="submit" class="btn btn-primary">跳转</button>
        			    				</div>
        			    				</form>
        			    			</div>
        			    		</div>
        			    	
        			    		<!-- 表格列表 -->
        			    		<div class="row">
        			    			<div class="col-lg-12">
        			    				<table class="table table-striped table-bordered table-hover no-footer" role="grid">
        			    					<thead>
        			    						<tr><th width="65px"><label><input id="selectAll" type="checkbox" onclick="javascript:selectAll(this,'uids')">全选</label></th>
                                                    <th>现金券ID</th>
                                                    <th>现金券名称</th>
                                                    <th>现金券状态</th>
                                                    <th width="90">领券开始时间</th>
                                                    <th width="90">领券结束时间</th>
                                                    <th>现金券类型</th>
                                                    <th width="150">创建时间</th>
                                                    <th>描述</th>
                                                    <th>现金券金额</th>
                                                    <th>初始化数量</th>
                                                    <th>已绑定数量</th>
                                                    <th>已消费数量</th>
                                                    <th>已发放数量</th>
                                                    <th>领取限额</th>
                                                    <th>有效月数</th>
                                                    <th>操作</th>
                                                </tr>
        			    					</thead>
        			    					<tbody>
        			    					<c:choose>
        			    						<c:when test="${empty pageModel.recordList }">
        			    							没有找到相关记录啊
        			    						</c:when>
        			    						<c:otherwise>
													<c:forEach items="${pageModel.recordList }" var="coupon">
		        			    					<tr role="row">
		        			    							<td><input type="checkbox" name="uids"></td>
		                                                    <td>${coupon.id }</td>
		                                                    <td>${coupon.name }</td>
		                                                    <td>
		                                                    <c:if test="${coupon.status eq 1 }">下线</c:if>
		                                                    <c:if test="${coupon.status eq 2 }">上线</c:if>
		                                                    </td>
		                                                    <td>
		                                                    <fmt:formatDate value="${coupon.start_date }" pattern="yyyy-MM-dd"></fmt:formatDate>
		                                                    </td>
		                                                    <td>
		                                                    <fmt:formatDate value="${coupon.end_date }" pattern="yyyy-MM-dd"></fmt:formatDate>
		                                                    </td>
		                                                    <td>
		                                                    <c:if test="${coupon.type eq 1 }">月数有效券</c:if>
		                                                    <c:if test="${coupon.type eq 2 }">固定期限券</c:if>
		                                                    <c:if test="${coupon.type eq 3 }">满额抵扣券</c:if>
		                                                    </td>
		                                                    <td><fmt:formatDate value="${coupon.create_time }" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
		                                                    <td>${coupon.description }</td>
		                                                    <td>${coupon.price }</td>
		                                                    <td>${coupon.init_number }</td>
		                                                    <td>${coupon.bind_number }</td>
		                                                    <td>${coupon.used_number }</td>
		                                                    <td>${coupon.send_number }</td>
		                                                    <td>${coupon.person_limit }</td>
		                                                    <td>
		                                                    <c:if test="${coupon.type eq 1 }">${coupon.month_limit }个月</c:if>
		                                                    </td>
		                                                    <td>
		                                                     <button class="btn btn-primary btn-sm" onclick="javascript:window.location.href='${bind_uri }?coupon_id=${coupon.id}&user_id=${couponQueryForm.user_id }';">派发</button>
		                                                    </td>
		        			    						</tr>
		        			    					</c:forEach>
        			    						</c:otherwise>
        			    					</c:choose>
        			    					
        			    					</tbody>
        			    				</table>
        			    			</div>
        			    		</div>
        			    		<hr />
        			    		<!-- 分页 -->
                                <br/>
        			    		<div class="row">
        			    			<div class="col-lg-10">
        			    			<form action="/sba/coupon/tobind" method="get">
        			    				<div class="ss-pagination">
                                            <span class="ui-text-box">共${pageModel.totalRecord }条 ${pageModel.pageTotal }页</span>
                                            <span class="ui-text-box">每页${pageModel.pageSize }条</span>
                                            <span class="ui-text-box">当前第${pageModel.pageNo }页</span>
        			    					<ul class="pagination">
        			    						<li class="previous ${pre_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.previousPageNo }">上一页</a></li>
        			    						<%@ include file="page_queue.jsp" %>
        			    						<li class="next ${next_disabled }" tabindex="0"><a href="${page_link }pageNo=${pageModel.nextPageNo }">下一页</a></li>
        			    					</ul>
        			    					
                                            <span>向第</span>
                                            <input type="text" class="form-control" name="pageNo" size="3">
                                            <input type="hidden" class="form-control" name="user_id" value="${couponQueryForm.user_id }">
                                            <span>页</span>
                                            <button type="submit" class="btn btn-primary">跳转</button>
        			    				</div>
        			    				</form>
        			    			</div>
        			    		</div>
        			    	</div>
            			</div>
            		</div>
            	</div>
            </div>
        </div>
	</div>
	<script src="/as/js/jquery-1.11.1.min.js"></script>
	<script src="/as/js/bootstrap.min.js"></script>
    <script src="/as/js/metisMenu.min.js"></script>
    <script src="/as/js/ss_common.js"></script>
    <script src="/as/js/My97DatePicker/WdatePicker.js"></script>

</body>
</html>